#include "stm32f10x.h"
#include "key.h"
#include "led.h"
#include "systick.h"
#include "dht11.h"
#include "usart.h"
#include <stdio.h>

/*******************
 *@brief:硬件初始化
 *@para:void
 *@return:void
 *******************/
void hardware_Init(void)
{
	led_Init();
	key_Init();
	Systick_Delay_Init();
	usart1_Init(115200);
	if(dht11_Init())
	{
		usart1_sendString("dht11 error\n");
		Systick_Delay_Ms(500);
	}
}

u8 temp;
u8 humi;
int main()
{
	char buf[32];
	hardware_Init();
	while(1)
	{
		dht11_Read_Data(&temp,&humi);
		sprintf(buf,"==temp:%d\t humi:%d==\n",temp,humi);
		usart1_sendString(buf);
		Systick_Delay_Ms(500);
	}
}
